package com.cxx.entity;

import java.io.Serializable;
import java.util.Objects;

/**
 *  部门类
 */

public class Department implements Serializable, Comparable<Department>{
    private int deptno;
    private String deptNmae;
    private String location;

    public Department(int deptno, String deptNmae, String location) {
        this.deptno = deptno;
        this.deptNmae = deptNmae;
        this.location = location;
    }

    public Department() {
    }

    public Department(int deptno, String deptName) {
        this.deptno  =  deptno;
        this.deptNmae = deptName;
    }

    @Override
    public String toString() {
        return "Department{" +
                "deptno=" + deptno +
                ", deptNmae='" + deptNmae + '\'' +
                ", location='" + location + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Department that = (Department) o;
        return deptno == that.deptno &&
                Objects.equals(deptNmae, that.deptNmae) &&
                Objects.equals(location, that.location);
    }

    @Override
    public int hashCode() {

        return Objects.hash(deptno, deptNmae, location);
    }

    public int getDeptno() {

        return deptno;
    }

    public void setDeptno(int deptno) {
        this.deptno = deptno;
    }

    public String getDeptNmae() {
        return deptNmae;
    }

    public void setDeptNmae(String deptNmae) {
        this.deptNmae = deptNmae;
    }

    public String getLocation() {
        return location;
    }

    public void setLocation(String location) {
        this.location = location;
    }

    @Override
    public int compareTo(Department o) {
        return this.deptno - o.deptno;
    }
}
